<template>
	<view class="orders">
		<view class="top1">
			<uv-navbar title="全部评价" bgColor="#65c9bb" height="44px" @click="goback"
				titleStyle="{font-weight: bold;font-size: 1.1rem;}"></uv-navbar>
		</view>
		<!-- 头部 -->
		<view class="top">
			<uv-tabs :list="list" activeStyle="color: #eff7f7;text-align: center;padding: 20rpx;"
				inactiveStyle="color: black;background-color: #65c9bb;text-align: center; padding: 20rpx" lineWidth='0'
				@click="click" :scrollable="false"></uv-tabs>
		</view>
		<!-- 全部-->
		<view v-if="current== 0" class="Mallorders">

			<view class="bottom" v-for="item in EvaluationList ">
				<view class="bottom-left">
					<uv-avatar :src="item.image"></uv-avatar>
				</view>
				<view class="bottom-right">
					<view class="one">{{item.members_name}}</view>
					<view class="two">
						<uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
						<view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
					</view>
					<view class="three">{{item.text}}</view>
					<view class="four">
						<image :src="item.images" mode=""></image>

					</view>
				</view>
			</view>
		</view>
		<!-- 好评 -->
		<view class="Mallorders" v-if="current== 1">
			<view class="bottom" v-for="item in comments ">
				<view class="bottom-left">
					<uv-avatar :src="item.image"></uv-avatar>
				</view>
				<view class="bottom-right">
					<view class="one">{{item.members_name}}</view>
					<view class="two">
						<uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
						<view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
					</view>
					<view class="three">{{item.text}}</view>
					<view class="four">
						<image :src="item.images" mode=""></image>

					</view>
				</view>
			</view>
		</view>
		<!-- 中评 -->
		<view class="Mallorders" v-if="current== 2">
			<view class="bottom" v-for="item in MediocreComment ">
				<view class="bottom-left">
					<uv-avatar :src="item.image"></uv-avatar>
				</view>
				<view class="bottom-right">
					<view class="one">{{item.members_name}}</view>
					<view class="two">
						<uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
						<view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
					</view>
					<view class="three">{{item.text}}</view>
					<view class="four">
						<image :src="item.images" mode=""></image>

					</view>
				</view>
			</view>
		</view>
		<!-- 差评 -->
		<view class="Mallorders" v-if="current== 3">
			<view class="bottom" v-for="item in NegativeComment ">
				<view class="bottom-left">
					<uv-avatar :src="item.image"></uv-avatar>
				</view>
				<view class="bottom-right">
					<view class="one">{{item.members_name}}</view>
					<view class="two">
						<uv-rate size="16px" :count="count" v-model="value1"></uv-rate>
						<view style="margin-left: 20rpx; color: #c1c1c1;">{{item.create_time}}</view>
					</view>
					<view class="three">{{item.text}}</view>
					<view class="four">
						<image :src="item.images" mode=""></image>
			
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		myRequest
	} from '@/request/request.js'
	export default {
		data() {
			return {
				// 评价列表
				EvaluationList: '',
				// 好评
				comments: '',
				// 中评
				MediocreComment: '',
				// 差评
				NegativeComment:'',
				count: 5,
				value1: 4,
				current: '',
				current1: '',
				list: [{
						name: '14万+ 全部',
					}, {
						name: '13万+ 好评',
					},
					{
						name: '1000+ 中评',
					},
					{
						name: '500+ 差评',
					},
				],

			}
		},
		onLoad() {
			const id1 = this.$route.query.name
			const id = id1.replace(/\"/g, "");
			console.log(id);
			// 查看师傅全部评价
			const that = this
			myRequest('master/index2?server=1', function(err, data) {
				if (err) {
					uni.showToast({
						title: err,
					});
				} else {
					that.EvaluationList = data.data
					// console.log("成功", that.EvaluationList);
				}
			}, 'POST', {
				id: id,
			})
			// 好评
			myRequest('apa/index1?server=1', function(err, data) {
				if (err) {
					console.log(err);
					uni.showToast({
						title: err,
					});
				} else {
					that.comments = data.data
					// console.log("好评", that.comments);
				}
			}, 'POST', {
				assess: '2',
				master_id: id,
				text: '好好好',
				images: '#'
			})
			// 中评
			myRequest('apa/index2?server=1', function(err, data) {
				if (err) {
					console.log(err);
					uni.showToast({
						title: err,
					});
				} else {
					that.MediocreComment = data.data
					// console.log("中评", that.MediocreComment);
				}
			}, 'POST', {
				assess: '2',
				master_id: id,
				text: '好好好',
				images: '#'
			})
			// 差评
			myRequest('apa/index3?server=1', function(err, data) {
				if (err) {
					console.log(err);
					uni.showToast({
						title: err,
					});
				} else {
					that.NegativeComment = data.data
					// console.log("差评", that.NegativeComment);
				}
			}, 'POST', {
				assess: '2',
				master_id: id,
				text: '好好好',
				images: '#'
			})
		},
		methods: {
			goback() {
				uni.navigateBack({
					delta: 1
				});
			},
			click(item) {
				this.current = item.index
				console.log('item', item);
			},
			click1(item) {
				this.current1 = item.index
				console.log('item', item);
			}
		}
	}
</script>

<style lang="scss">
	@import url("evaluation.scss");
</style>